/*******************************************************************************
* @brief  uart
*******************************************************************************/

#include "bsp.h"
#include "com_obj.h"
#include "stdio.h"
#include "framework.h"

/*******************************************************************************
* @brief  printf surport
*******************************************************************************/
#if !defined(__MICROLIB)

#ifdef __ARMCC_VERSION
#if __ARMCC_VERSION >= 6010050
__asm (".global __use_no_semihosting\n\t");
#else
#pragma import(__use_no_semihosting)
struct __FILE
{
  int handle;
};
#endif

//FILE __stdout;

#endif

//避免使用半主机模式
void _sys_exit(int x)
{
	x = x;
}

//__use_no_semihosting was requested, but _ttywrch was 
void _ttywrch(int ch)
{
    ch = ch;
}

#endif

#if defined ( __GNUC__ ) && !defined (__clang__) 
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif 

PUTCHAR_PROTOTYPE
{
	#if DBG_EN > 0
    dbg_port_obj.fun->hal_send(ch);
	#endif
		
	return ch;
}


/*******************************************************************************
* @brief  bsp_uart_init
* \param[in] none
* \retval: none
*******************************************************************************/
void bsp_uart_init(void)
{
	dbg_port_init(0, 115200, COM_PAR_NONE_1S);
}
